package com.lafengmaker.admin.controller;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.lafengmaker.admin.entity.User;
import com.lafengmaker.admin.service.UserService;

@Controller()
@RequestMapping("/admin")
public class UserController {
	private Logger logger=Logger.getLogger(UserController.class);
	@Autowired
	private UserService userService;
	@RequestMapping("/login")
	public String login(String username,String password){
		
		try {
			User u=userService.userLonin(username, password);
			logger.info(u.getUsername());
			return "success";
		} catch (Exception e) {
			logger.error("login error", e);
		}
		return "index";
	}
}
